using Crux.Core;
using Crux.Core.Cache.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace System;
/// <summary>
/// CacheServiceCollectionsExtensions
/// </summary>
public static class CacheServiceCollectionsExtensions
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="serviceDescriptors"></param>
    /// <returns></returns>
    public static IServiceCollection AddHybridCache(this IServiceCollection serviceDescriptors)
    {
        serviceDescriptors.TryAddScoped<IHybridCacheProvider, HybridCacheProvider>();
        serviceDescriptors.TryAddScoped<ILockProvider, LockProvider>();
        serviceDescriptors.TryAddScoped<IHashProvider, XxHash64Unsafe>();

        return serviceDescriptors;
    }
}